home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
macros
/
texsis
/
VMS
/
TEXSIS10.COM
< prev
Wrap
Text File
|
1992-08-02
|
62KB
|
1,289 lines
$! === THIS IS AN ARCHIVE FILE -- DELETE EVERYTHING ABOVE THIS LINE ===
$! === THEN EXECUTE THIS FILE WITH "@TEXSIS10.COM" ===
$! Contents:
$! TXSdcol.tex
$! TXSenvmt.tex
$! =========== TXSdcol.tex ============
$ copy sys$input TXSdcol.tex
% TXSdcol.tex TeXsis version 2.15
% $Revision: 15.6 $ : $Date: 92/06/02 15:56:46 $ : $Author: myers $
%======================================================================*
% DOUBLE COLUMN FORMAT E. Myers and F.E. Paige
%
% TXSdcol produces double-column output with balanced columns and
% floating single and double column insertions. Adapted from The TeXBook,
% pg 417, and The TUGboat, Vol 6, pg 29.
%
% \setdoublecolumns initializes the double column format, including
% setting \hsize and \vsize:
%
% \setdoublecolumns#1#2#3 initializes double column format
% #1 = overall width
% #2 = overall height
% #3 = column width
% Note that \setdoublecolumns redefines \output.
%
% \doublecolumns and \enddoublecolumns are used to switch between
% single and double column format:
%
% \doublecolumns starts double column format
% \enddoublecolumns returns to single column format and
% balances columns
% \longequation begins a long (2-column) equation
% \endlongequation ends a long equation
% \leftcolrule draws a rule across left column
% \rightcolrule draws a rule across right column
%
% Insertions of figures or other vertical mode material can be made
% using the following macros, which are similar to those in Plain TeX:
%
% \topinsert insert at top of current column
% \midinsert insert at current position or at top
% \pageinsert insert full column
% \widetopinsert insert across 2 columns at top of page
% \widepageinsert insert full page across 2 columns
% \endinsert end insertion
%
% The material is put in the left or right column depending on the current
% position. A specific column can be forced by putting inside the insertion
%
% \forceleft force left column insertion
% \forceright force right column insertion
%
% Outside of double column mode, \widetopinsert is equivalent to \topinsert.
%
%
% A typical TeXsis double-column document will contain:
%
% \texsis % initialize
% \setdoublecolumns{width}{height}{colwidth} % in cm, in, pt,...
% ... title page, etc ...
% ... title, author, etc ... % default is single column
% \doublecolumns % switch to 2 columns
% ... text ...
% \longequation
% $$
% ... long equation, table, etc ... % across both columns
% $$
% \endlongequation
% ... text ...
% \figure{foo} % insert at top of column
% ... top matter ...
% \endfigure % end insertion
% ... text ...
% \enddoublecolumns % end
% \bye
%
% Since double columns are narrow, the normal TeX spacing will produce
% many overfull hboxes. To avoid this, the interword skip \spaceskip is
% replaced by \doublecolskip with the default value
% \doublecolskip=.3333em plus .3333em minus .1em
% and the \hyphenpenalty is set to zero. To balance the columns, it is
% necessary to allow some vertical stretch; for example use
% \parskip=\smallskipamount
%
% To type oversize documents on an 8.5 x 11 inch laser printer, use
% \ninepoint and set the dimensions in \setdoublecolumns to 9/12 of the
% desired size. Then the document enlarged by 4/3 will be correct.
%
%
% WARNING: Formatting double column documents is very difficult. There
% are many special cases, only some of which are handled in these macros.
% The following is a list of known problems:
%
% (1) Since double columns are narrow, the normal TeX spacing produces
% many overfull \hbox's. To avoid this, the interword skip \spaceskip is
% changed to
% \doublecolskip=.3333em plus .3333em minus .1em
% More uniform spacing can be obtained by changing \doublecolskip.
%
% (2) To balance columns it is essential to have some stretch in the
% column. For example, use
% \parskip=\smallskipamount
% (This is done automatically in \IEEEproceedings.)
%
% (3) If the page cannot be balanced, an error message is produced. To
% see the page, try typing i\vfill after the ? prompt.
%
% (4) Insertions which do not fit on a page move to the same column
% of the next page, so figures may appear in the wrong order. To fix this
% move the insertion to a different position or use \forceleft or \forceright.
%
% (5) A \topinsert placed after a \midinsert may appear before it, just
% as in Plain. To avoid this, rearrange the figures or use \topinsert for all
% figures.
%
% (6) Footnotes are not implemented. These may be added in the future.
%
% (7) Running headlines and footlines are added to each page. But
% forming the double columns destroys the top and bottom marks on the page,
% so the standard TeXsis headlines and footlines do not work very well.
%
%-----------------------------------------------------------------------
% \twinout is much simpler than \setdoublecolumns; it simply
% redefines \output to produce a reduced format output with two pages per
% physical page in landscape format. Usage with TeXsis:
%
% [\twinhsize=<dimen>] % horizontal width
% [\twinvsize=<dimen>] % vertical height
% [\twincsize=<dimen>] % column width
% [\def\LandscapeSpecial{\special{...}}] % \special for landscape
% \texsis
% \tenpoint
% \def\Tbf{\twelvebf}
% \def\tbf{\tenbf}
% \twinout
%
% Adapted from Harvmac by Paul Ginsparg.
% -----------------------------------------------------------------------
%
% Dependencies: This file is independent of the rest of TeXsis and
% can be used with Plain TeX.
%
% -----------------------------------------------------------------------
\message{Double Column Format.}
\catcode`@=11 % make @ a letter for this file
\newdimen\colwidth % col. width
\newdimen\pagewidth % total width
\newdimen\pageheight % total height
\newdimen\ruleht \ruleht=.5pt % col. rule height
\newdimen\colmaxdepth \colmaxdepth=4pt % max. split depth
\newdimen\bigc@lheight % 2 * col. height
\newdimen\l@ftpluscenter % left + middle
\newdimen\splitmaxs@ve % save \splitmaxdepth
\newdimen\s@vesize % save \vsize
% TXShead.tex defines similar dimensions for headlines, but if if
% has not been loaded then we need to create new ones.
\newdimen\wideheadlineoffset \wideheadlineoffset=0.0pt % how much to raise
\newdimen\widefootlineoffset \widefootlineoffset=0.0pt % how much to lower
\newskip\s@veskip % save \spaceskip
\newskip\doublecolskip % new \spaceskip
\doublecolskip=.3333em plus .3333em minus .1em % with more stretch
\newbox\partialpage % partial page
\newinsert\leftins \count\leftins=1000 % left col. insert
\dimen\leftins=\maxdimen \skip\leftins=0pt %
\newinsert\rightins \count\rightins=1000 % right col. insert
\dimen\rightins=\maxdimen \skip\rightins=0pt %
\newif\ifleftc@lumn % insert left col.
\newif\ifwid@ \wid@false % wide insert
%----------------------------------------------------------------------*
% Until or unless you say \setdoublecolumns, the \doublecolumns,
% \enddoublecolumns, \leftcolrule and \rightcolrule macros are
% simply \relax. This is so you can put these in a document that
% uses double columns, but then print it with one of the single
% column formats without them getting in the way. Or vice versa.
%
% For the same reason, \widetopinsert and \widefullinsert are just
% \topinsert and \fullinsert. There is no need to define the table and
% figure macros here because they use appropriate the inserts.
\colwidth=\hsize % default column width is \hsize
\def\doublecolumns{\relax}
\def\enddoublecolumns{\relax}
\def\leftcolrule{\relax}
\def\rightcolrule{\relax}
\def\longequation{\relax}
\def\endlongequation{\relax}
\def\newcolumn{\relax}
\def\widetopinsert{\topinsert}
\def\widepageinsert{\pageinsert}
\def\begindoublecolumns{\doublecolumns} % synonym
\def\singlecolumn{\enddoublecolumns} % synonym
% Save Plain definitions of inserts to we can use them
\let\topinsertpl@in=\topinsert
\let\midinsertpl@in=\midinsert
\let\pageinsertpl@in=\pageinsert
\let\endinsertpl@in=\endinsert
% \@newcolumn is like \newpage but only active in double column mode
\def\@newcolumn{\vfill\eject}
%----------------------------------------------------------------------*
% \setdoublecolumns initializes double column format. #1 is the
% overall width, #2 is the height, and #3 is the column width.
\def\setdoublecolumns#1#2#3{%
\global\hsize=#1\relax % width
\global\vsize=#2\relax % height
\global\colwidth=#3\relax % column width
\pagewidth=\hsize \pageheight=\vsize % page sizes
\bigc@lheight=\vsize % total height = \vsize
\multiply \bigc@lheight by 2 % times 2
\l@ftpluscenter=\pagewidth % \l@ftpluscenter = size
\advance \l@ftpluscenter by -\colwidth % to right column
\dimen\leftins=\pageheight % max. insert
\dimen\rightins=\pageheight % max. insert
\output{\onep@geout{\unvbox255}}% % just ship out page
\let\doublecolumns=\@doublecolumns % enable \doublecolumns
\let\enddoublecolumns=\@enddoublecolumns % enable \enddoublecolumns
\let\rightcolrule=\@rightcolrule % enable
\let\leftcolrule=\@leftcolrule %
\def\longequation{\@longequation}% % to begin long equations
}
% \@doublecolumns starts double column output. It redefines \endinsert
% to handle double column insertions and \widetopinsert and \widepageinsert
% to do them.
\def\@doublecolumns{% % begin 2 columns
\begingroup % keep changes local
\def\endmode{\@enddoublecolumns} % how to end
\output={\global\setbox\partialpage=% % set up output
\vbox{% % box containing...
\ifvoid\topins\else\unvbox\topins\fi% %top insert
\unvbox255}}\eject % and main page
\output={\d@ublec@lumnout}% % set 2 column output
\s@vesize=\vsize % save old \vsize
\hsize=\colwidth\vsize=\bigc@lheight % set width, 2*height
\advance \vsize by -2\ht\partialpage % less partial page
\advance \vsize by -2\dp\partialpage % less partial page
\global\s@veskip=\spaceskip % save old interword glue
\global\spaceskip=\doublecolskip % stretch for small cols.
\global\displaywidth=\colwidth % equations have \colwidth
\global\hyphenpenalty=0 % hyphens are OK
\let\topinsert=\topinsertd@uble % 2-col top insert
\global\let\midinsert=\midinsertd@uble % mid insert
\global\let\pageinsert=\pageinsertd@uble % full column insert
\global\let\endinsert=\endinsertd@uble % 2-col end inserts
\global\let\widetopinsert=\widet@pinsert % allow wide inserts
\global\let\widepageinsert=\widep@geinsert % or full page inserts
\global\let\newcolumn=\@newcolumn % to break columns
}
%----------------------------------------------------------------------*
% \@enddoublecolumns ends double column output and balances columns.
% This also allows double width equations. The grouping insures that
% \endinsert is reset to the Plain version.
\def\@enddoublecolumns{% % end double column mode
\output={\b@lancecolumns}\eject % output 2 columns
\global\output={\onep@geout{% % output page =
\ifvoid\topins\else\unvbox\topins\fi % top insert
\unvbox255}}% % plus main page
\global\vsize=\s@vesize % reset vsize
\endgroup % end 2 col. group
\pagegoal=\vsize % overall goal size
\spaceskip=\s@veskip % reset interword glue
\displaywidth=\hsize % equation width
\hyphenpenalty=50 % hyphen penalty
\global\let\topinsert=\topinsertpl@in % top insert
\global\let\midinsert=\midinsertpl@in % mid insert
\global\let\pageinsert=\pageinsertpl@in % page insert
\global\let\endinsert=\endinsertpl@in % end insert
\global\let\widetopinsert=\topinsertpl@in % wide insert
\global\let\widepageinsert=\pageinsertpl@in % page insert
\count\topins=1000 % standard top insert
} % end of \@enddoublecolumns
%----------------------------------------------------------------------*
% Output and related routines:
% \onep@geout ships out a page. From the TeXbook, p. 416. Running
% headlines and footlines have been added.
\def\onep@geout#1{% % output one page
\shipout\vbox{% % output a box
\offinterlineskip % no interline skip
\wideheadline % make wide headline
\vbox to \pageheight{#1% % box containing #1
\boxmaxdepth=\maxdepth}% %
\widefootline}% % make wide footline
\advancepageno}% % increment page number
% The following are like \makeheadline and \makefootline in Plain
% except that they use \pagewidth.
\def\wideheadline{% % make wide headline
\vbox to\z@{\vskip-22.5\p@% % skip up some
\vskip-\wideheadlineoffset % and then some, if needed
\hbox to \pagewidth{% % like \line
\vbox to8.5\p@{}\the\headline}\vss}% % content in \headline
\nointerlineskip}% %
\def\widefootline{% % make wide footline
\baselineskip24\p@% % space down
\vskip\widefootlineoffset % and then some, if needed
\hbox to \pagewidth{\the\footline}}% % content in \footline
% \d@ublec@lumnout splits the page into two columns, inserting any
% top insertions which have accumulated.
\def\d@ublec@lumnout{% %
\splitmaxs@ve=\splitmaxdepth % save it
\splitmaxdepth=\colmaxdepth % and reset it
\dimen@=\pageheight % total height...
\advance\dimen@ by -\ht\partialpage % less partial page
\advance\dimen@ by -\dp\partialpage % less partial page
\ifvoid\topins\else % if undone top insert
\advance\dimen@ by -\ht\topins % subtract its height
\advance\dimen@ by -\dp\topins\fi % subtract its height
\splittopskip=\topskip % top glue for splits
\ifdim\dimen@>\baselineskip% % if room for 1 line...
\setbox3=\vbox{% % box3 = working box
\ifvoid\leftins\else\unvbox\leftins\fi%% left insertion
\unvbox255}% % plus main material
\setbox1=\vsplit3 to \dimen@ % box1 = left column
\setbox4=\vbox{% % box4 = working box
\ifvoid\rightins\else\unvbox\rightins\fi% right insertion
\unvbox3}% % rest if main material
\setbox2=\vsplit4 to \dimen@ % box2 = right column
\setbox255=\vbox{\unvbox255\unvbox4}% % rest back on output list
\else% % ... else no room
\setbox1=\vbox{}% % so do nothing
\setbox2=\vbox{}% %
\fi% % end if no room
\onep@geout\p@gesofar% % output page
\global\vsize=\bigc@lheight% %
\unvbox255 \penalty\outputpenalty% %
\splitmaxdepth=\splitmaxs@ve}% % reset it
% \p@gesofar adds double column material to the page, putting box1 on the
% left, box2 on the right.
\def\p@gesofar{% %
\ifvoid\topins\else\unvbox\topins\fi % unbox top insert
\unvbox\partialpage % unbox partial page
\wd1=\hsize \wd2=\hsize % set sizes
\hbox to \pagewidth{\box1\hfil\box2}}% % and combining 2 boxes
% \b@lancecolumns is the output routine for 2 balanced columns. Taken
% from The TeXbook, p. 417, with major modifications.
\def\b@lancecolumns{% %
\splitmaxs@ve=\splitmaxdepth% % save it
\splitmaxdepth=\colmaxdepth% % and reset it
\setbox0=\vbox{% % box0 = working box
\ifvoid\leftins\else\unvbox\leftins\fi% % left insert
\unvbox255}% % plus main page
\dimen@=\ht0 \advance\dimen@ by \dp0% % get height
\ifvoid\rightins\else% % if right insert
\advance \dimen@ by \ht\rightins% % add its height
\advance \dimen@ by \dp\rightins\fi% % add its height
\ifvoid\topins\else % if undone top insert
\advance\dimen@ by -\ht\topins % subtract its height
\advance\dimen@ by -\dp\topins\fi % subtract its height
\advance \dimen@ by \topskip % add top skip
\advance \dimen@ by -\baselineskip % add baseline skip
\divide \dimen@ by 2% % and divide by 2
\splittopskip=\topskip % top skip for split boxes
% Loop over possible splits of text into left and right columns.
{\vbadness=10000 \loop% % suppress errors
\setbox3=\copy0% % box3 = working copy
\setbox6=\copy\rightins% % box6 = working rightins
\global\setbox4=\vbox{% % box 4 =
\vsplit3 to\dimen@}% % left column
\global\setbox5=\vbox{% % box5 = right column
\ifvoid\rightins\else\unvbox6\fi% % right insert
\unvbox3}% % rest of text
\ifdim\ht5>\dimen@% % if box5 too big,
\global\advance\dimen@ by 1pt\repeat}% % increment and try again
% End loop over possible splits. Set up output.
\dimen@ = \ht4 \dimen5 = \ht5% % get heights
\ifdim\dimen5 > \dimen@ \dimen@=\dimen5 \fi% % find larger
\setbox1=\vbox to \dimen@{\unvbox4}% % box1 = left column
\setbox2=\vbox to \dimen@{\unvbox5}% % box2 = right column
\global\output={\b@lancingerror}% % prepare for error
\p@gesofar% % and output page
\splitmaxdepth=\splitmaxs@ve}% % reset it
% if there is a problem balancing the lines we display an error message
\newhelp\b@l@ncingerror{%
b@lancecolumns: I couldn't figure out how to balance the^^J
two columns. Maybe you can re-arange some text to make ^^J
the job easier. To see the page anyway try inserting a \string\vfill.}
\def\b@lancingerror{% % error exit
\newlinechar=10 % ^^J is line break
\errhelp=\b@l@ncingerror % longer help message
\errmessage{Page cannot be balanced}% % error message
\onep@geout{\unvbox255}}% % do something
%======================================================================*
% \@leftcolrule and \@rightcolrule put rules across left and right
% columns for spanned equations
\def\@leftcolrule{% Rule across bottom of left column
\vskip 2pt\nointerlineskip % some whitespace first
\vbox to \baselineskip{\hbox to \colwidth{ % short vertical bar at right
\hss \vrule height6pt width\ruleht}% % and above the horiz. rule
\hrule width\colwidth height\ruleht}% % rule
\vskip 4pt}
\def\@rightcolrule{\vskip 4pt
\moveright\l@ftpluscenter % move over
\vbox to \baselineskip {%
\hrule width\colwidth height\ruleht % rule across column
\hbox to \colwidth{% %
\vrule height 6pt width\ruleht\hss}%
}}
\def\@longequation{% what to do for a long (2-column) equation
\enddoublecolumns % single column mode
\leftcolrule % and draw a rule
\def\endlongequation{\@endlongequation}} % how to get out
\def\@endlongequation{ % ending a long equation
\rightcolrule % rule at top of right column
\doublecolumns} % then back to double column mode
\def\longequation{\relax} % default for single column
\def\endlongequation{\relax} % does nothing
%----------------------------------------------------------------------*
% Floating insertions:
% \endinsertd@uble is a modified version of \endinsert from Plain which
% decides whether to put a top insertion in the left or the right column.
% \endinsert is let equal this in \doublecolumns.
% Note: Writing \ifdim\pagetotal<\dimen1 ... near the beginning of this
% macro worked with an \emsg{\the\pagetotal} preceding it but failed when it
% was removed. \dimen3 =\pagetotal \ifdim\dimen3 <\dimen1 ... seems to work.
% Is this a bug or a feature???
\def\endinsertd@uble{\egroup% % finish the \vbox
% Decide whether in left or right column.
\dimen2 =\vsize% % 2 col. height = \vsize
\dimen1 =\dimen2 \divide\dimen1 by 2% % 1 col height = 1/2 \dimen2
\dimen3 =\pagetotal% % get value of pagetotal
\ifdim\dimen3 <\dimen1 \leftc@lumntrue% % left if page total < 1 col
\else \leftc@lumnfalse\fi % right otherwise
\ifx L\LRf@rce \leftc@lumntrue \fi % forced left
\ifx R\LRf@rce \leftc@lumnfalse \fi % forced right
% If midinsert requested, decide whether there is room.
\if@mid % midinsert selected
\dimen@\ht\z@ \advance\dimen@\dp\z@% % dimen0 = height + depth
\advance\dimen@ \baselineskip% % + baselineskip
\advance\dimen@\pagetotal% % + page total
\ifleftc@lumn % if in left column
\ifdim\dimen@>\dimen1 % % \dimen1 = 1 col height
\@midfalse\p@gefalse\fi % top insert
\else% % in right column
\ifdim\dimen@>\dimen2 % % \dimen2 = 2 col height
\@midfalse\p@gefalse\fi\fi % top insert
\fi % end if@mid
% If room for midinsert, do it; otherwise make topinsert in same column.
\if@mid \bigskip\box\z@\bigbreak% % if mid, insert
\else% % doesn't fit
\ifwid@% % wide insert
\count\topins=2000% % counts 2 x 1000 for length
\insert\topins{\penalty100% % put wide insertion into
\topskip\z@skip\splittopskip\z@skip% % \topins with inserts
\splitmaxdepth\maxdimen% % from 1-col mode.
\floatingpenalty\z@% % no penalty
\hsize=\pagewidth% % full width
\ifp@ge \dimen@\dp\z@% % dimen0 = depth
\vbox to\pageheight{\unvbox\z@% % full page = \pageheight
\kern-\dimen@}% %
\else \box\z@\nobreak\bigskip\fi}% % just add box0
\else% % single column insertion
\ifleftc@lumn% % in left column
\let\m@keins=\leftins% % so insert in left
\else \let\m@keins=\rightins\fi % or insert in right
\insert\m@keins{\penalty100% % do the insertion just
\splittopskip\z@skip% % like Plain TeX...
\splitmaxdepth\maxdimen% %
\floatingpenalty\z@% %
\ifp@ge \dimen@\dp\z@% % full page insert
\vbox to\pageheight{\unvbox\z@% % height is pageheight
\kern-\dimen@}% % depth is 0pt
\else \box\z@\nobreak\bigskip\fi}% % top insert
\fi % end ifwid@
\fi\endgroup% % end if@mid
\global\let\LRf@rce=X}% % reset forcing flag
% \@widetopinsert makes a floating insertion across both columns. It
% uses the same \topins as the normal top insert because it goes in the same
% place. \widetopinsert is let equal to this by \doublecolumns.
\def\widet@pinsert{% % let \widetopinsert = this
\@midfalse % not mid insert
\p@gefalse % not page
\wid@true % is wide
\@ins % Plain insert macro
\hsize=\pagewidth} % but set full width
\def\widep@geinsert{% % let \widepageinsert = this
\@midfalse % not mid insert
\p@getrue % not page
\wid@true % is wide
\@ins % Plain insert macro
\hsize=\pagewidth} % but set full width
% \topinsertd@uble,... are like \topinsert,... in Plain but also reset
% \ifwid@ for wide inserts. \topinsert,... are set to these by \doublecolumns.
% The Plain versions must be saved to reset these in \enddoublecolumns.
\def\topinsertd@uble{\@midfalse\p@gefalse\wid@false\@ins}
\def\midinsertd@uble{\@midtrue\wid@false\@ins}
\def\pageinsertd@uble{\@midfalse\p@getrue\wid@false\@ins}
% \forceleft and \forceright force left and right insertions independent
% of the current column position.
\def\forceleft{\global\let\LRf@rce=L} % force left insert
\def\forceright{\global\let\LRf@rce=R} % force right insert
\let\LRf@rce=X % default is no force
%======================================================================*
% TWIN PAGE OUTPUT
% \twinout is much simpler than \setdoublecolumns; it simply
% redefines \output to produce a reduced format output with two pages per
% physical page in landscape format.
%-----------------------------------------------------------------------
% Counters and such
\newbox\l@ftp@ge % box for first column
\newdimen\twinhsize \twinhsize=10truein % twin width
\newdimen\twinvsize \twinvsize=7truein % twin height
\newdimen\twincsize \twincsize=4.75truein % twin column width
\newdimen\normhsize \normhsize=6.5truein % normal hsize
\newdimen\normvsize \normvsize=9.0truein % normal vsize
% \LandscapeSpecial is the \special hack for landscape. Otherwise
% you can use the landscape option for the device driver. The default
% is for dvips 5.484 by Tom Rokikki:
\def\LandscapeSpecial{\special{papersize=11in,8.5in}}
% \twinout redefines \output to generate two columns per page.
% You should also set font sizes, etc.
\def\twinout{% % reduced size output
\def\l@r{L}% % left-right flag
\hsize=\twincsize % twin col width
\vsize=\twinvsize % twin height
\twin@ffset % twin offsets
\output={\almostship@ut{\leftline{\vbox{% % new \output
\makeheadline\pagebody\makefootline}}}% % just like Plain
\advancepageno}% % advance number
}
% \twin@ffset sets the offsets for \twinout assuming that the
% initial offsets are 0pt. Otherwise trouble...
\def\twin@ffset{% % set \twinout sizes
\dimen0 =\twinhsize % get new \hsize
\advance\dimen0 by-\normvsize % subtract normal
\divide\dimen0 by 2 % divide by 2
\global\hoffset=-\dimen0 % and fix \hoffset
\dimen0 =\twinvsize % get new \vsize
\advance\dimen0 by-\normhsize % subtract normal
\divide\dimen0 by 2 % divide by 2
\global\voffset=-\dimen0 % and fix \voffset
}
% \almostship@ut either builds a box or does a \shipout of the
% new box plus the old \leftb@x.
\def\almostship@ut#1{% % new \shipout
\if L\l@r% % left page
\global\setbox\l@ftp@ge=#1 % save in box
\global\let\l@r=R % set flag
\message{[\the\pageno]}% % page number
\else % right page
\shipout\vbox{\LandscapeSpecial% % \special hack
\hbox to \twinhsize{\box\l@ftp@ge\hfil#1}}%% text
\global\let\l@r=L % reset flag
\fi}
%-----------------------------------------------------------------------
\catcode`@=12
% >>> EOF TXSdcol.tex <<<
$! =========== TXSenvmt.tex ============
$ copy sys$input TXSenvmt.tex
%% TXSenvmt.tex TeXsis version 2.15
% $Revision: 15.10 $ : $Date: 92/07/31 15:42:00 $ : $Author: myers $
%=======================================================================*
% SPECIAL TEXT ENVIRONMENTS - This file is a part of TeXsis
% (C) copyright 1991 by Eric Myers and Frank Paige.
%
%
% These macros provide a variety of simple enviroments for arranging
% text in special ways. They are listed here and described in more
% detail below. Generally the syntax is \NAME... \endNAME.
%
% The following "flush environments" arrange text in special ways:
%
% \center Center each line.
% \flushleft Make each line flush left.
% \flushright Make each line flush right.
% \raggedcenter Make each line as long as possible and then
% center it.
%
% Use these in vertical mode. For the horizontal mode equivalants
% are: \hcenter, \hflushleft, \hflushright
%
% The following are for making various sorts of lists:
%
% \itemize List of items, with a bullet in front of each.
% Use \itm to begin each item.
% \enumerate Makes a list of items, each of them numbered.
% Use \itm to begin each item.
% \description List of items and descriptions, with the form:
% item1 text for item1, which may take
% more than one line
% item2 text for item2
% ...
% Use \itm{item1}, etc... (see below).
%
% The following display theorems and proofs in quasi-SIAM format
% with automatic numbering:
%
% \theorem
% \lemma
% \definition
% \proof
%
% The following are designed for typing computer code, TeX examples ,
% and similar material:
%
% \Listing Prints text in \tt type, with \obeylines,
% \obeyspaces, as appropriate for computer code
% listings.
% \ListCodeFile{filename} to list source code from a file.
% \TeXquoteon Makes | a TeX quote: everything in | ... | is
% printed verbatim in \tt type.
% \TeXexample Prints a TeX example verbatim in \tt type, with |
% being the escape character and |endTeXexample
% ending the enviroment. Can be used for examples
% continuing over more than one page.
% \ttverbatim Makes all characters ordinary and begins a group
% using \tt type.
% \begintt Example macro taken from The TeXbook.
% \beginlines Example macro taken from The TeXbook.
%
%
% Source: adapted from TechRpt's TechEnv and the TeXbook
%
% Dependencies: TXSmacs.tex
%======================================================================*
\message{Environments.}
\catcode`@=11 % make @ a letter for now
\chardef\other=12
%==================================================*
% CENTERING ENVIRONMENTS:
% \center, \flushleft, \flushright, \raggedcenter
% Note: these are all \obeylines environments
\def\center{% begin centering environment
\flushenv % general setup
\advance\leftskip \z@ plus 1fil % add hfil glue on each
\advance\rightskip \z@ plus 1fil % side
\obeylines\@eatpar} % obey line ends
\def\flushright{% begin flush right environment
\flushenv % general setup
\advance\leftskip \z@ plus 1fil % hfil on left
\obeylines\@eatpar} % obey line ends
\def\flushleft{% begin flush left environment
\flushenv % general setup
\advance\rightskip \z@ plus 1fil % hfil on right
\obeylines\@eatpar} % obey line ends
\def\flushenv{% common startup for all flush/center environments
\vskip \z@ % force vertical mode
\bgroup % begin grouping
\def\flushhmode{F}% % flag: not hmode
\parindent=\z@ \parfillskip=\z@} %
\def\endcenter{\endflushenv}
\def\endflushleft{\endflushenv}
\def\endflushright{\endflushenv}
% \@eatpar gets rid of any \par that follows
\def\@eatpar#1{\ifx#1\par\relax\else#1\fi}
%---------------------------------*
% \raggedcenter centers ragged lines, e.g. for titles. Each line will
% be as long as possible, centered. Line breaks in the manuscript file are
% ignored.
\def\raggedcenter{% center lines as long as they can be
\flushenv % do common stuff
\advance\leftskip\z@ plus4em % add stretch to sides
\advance\rightskip\z@ plus 4em % add stretch to sides
\spaceskip=.3333em \xspaceskip=.5em %
\pretolerance=9999 \tolerance=9999 %
\hyphenpenalty=9999 \exhyphenpenalty=9999 % no hyphens!
\@eatpar} %
\def\endraggedcenter{\endflushenv} % ends like all flushenv's
%---------------------------------*
% \hcenter, \hflushleft, \hflushright are like the things above,
% but are for use in horizontal mode. They put the results in a box of
% size zero. This is no longer automatic in \center and its variations,
% to avoid confusion.
% Notes: \vtop makes the TOPS of the items line up; \vbox would make the
% bottoms (actually, the baselines) line up.
\def\hcenter{\hflushenv %
\advance\leftskip \z@ plus 1fil %
\advance\rightskip \z@ plus 1fil %
\obeylines\@eatpar} %
\def\hflushright{\hflushenv %
\advance\leftskip \z@ plus 1fil %
\obeylines\@eatpar} %
\def\hflushleft{\hflushenv %
\advance\rightskip \z@ plus 1fil %
\obeylines\@eatpar} %
\def\hflushenv{% common startup for all hflush/hcenter environments:
\def\par{\endgraf\indent}% % for use in hmode
\hbox to \z@ \bgroup\hss\vtop % start a box of size zero
\flushenv\def\flushhmode{T}} %
\def\endflushenv{% common end to all flush/center environments
\ifhmode\endgraf\fi % if hmode, end \par
\if T\flushhmode \egroup\hss\fi % close group and box, or
\egroup} % end the grouping
\def\endhcenter{\endflushenv}
\def\endhflushleft{\endflushenv}
\def\endhflushright{\endflushenv}
%==================================================*
% LIST ENVIRONMENTS:
%
% All 'list' environments are surrounded by a certain amount of skip.
% These skips are: \EnvTopskip, \EnvBottomskip, \EnvLeftskip, \EnvRightskip
% These are set here, but you may change them if you like.
\newskip\EnvTopskip \EnvTopskip=\medskipamount % skip before
\newskip\EnvBottomskip \EnvBottomskip=\medskipamount % skip after
\newskip\EnvLeftskip \EnvLeftskip=2\parindent % left indent
\newskip\EnvRightskip \EnvRightskip=\parindent % right margin in too
\newskip\EnvDelt@skip \EnvDelt@skip=0pt % nested skip amount
\newcount\@envDepth \@envDepth=\z@ % depth of environments
% \beginEnv{<name>} does common processing for starting a
% list environment. \endEnv{<name>} does common end procesing,
% and checks the name to make sure that the environments balance.
\def\beginEnv#1{% begin a ``list'' environment
\begingroup % environment is inside a group
\def\@envname{#1}% % save envmt name, to check at end
\ifvmode\def\@isVmode{T}% % remember existing V/H mode
\else\def\@isVmode{F}\vskip 0pt\fi % hmode: force vertical mode
%
\ifnum\@envDepth=\@ne\parindent=\z@\fi % 1st envmt? no parindent
\global\advance\@envDepth by \@ne % increment level by one
\EnvDelt@skip=\baselineskip % \EnvDelt@skip is \baselineskip
\advance\EnvDelt@skip by-\normalbaselineskip% minus \normalbaselineskip
\@setenvmargins\EnvLeftskip\EnvRightskip % now adjust margins.
\setenvskip{\EnvTopskip}% % get appropriate topskip
\vskip\skip@\penalty-500 % and do it (good place to break)
}
\def\endEnv#1{% end a ``list'' environment
\ifnum\@envDepth<1 % is there nothing open?
\emsg{> Tried to close ``#1'' environment, but no environment open!}%
\begingroup % \endgroup below would produce error
\else % No: there was an environment open
\def\test{#1}% % was right thing closed?
\ifx\test\@envname\else % check that the names match
\emsg{> Miss-matched environments!}%
\emsg{> Should be closing ``\@envname'' instead of ``\test''}%
\fi %
\fi %
%
\vskip 0pt % force vmode, finish any paragraph
\setenvskip\EnvBottomskip % and skip a bottomskip which is
\vskip\skip@\penalty-500 % appropriate here (good breakpoint)
\xdef\@envtemp{\@isVmode}% % save \@isVmode for outside group
\endgroup % end grouping of environment
\global\advance\@envDepth by -\@ne % decrement environment level
\if F\@envtemp\vskip-\parskip\noindent\fi % no indent if didn't start in vmode
}
% \setenvskip chooses a skip amount based on the current \@envDepth,
% and puts it into \skip@, which is a temporary skip register.
\def\setenvskip#1{\skip@=#1 \divide\skip@ by \@envDepth}
% \@setenvmargins{<left amount>}{<right amount>} adjusts the area of
% the page to be used by changing \rightskip, \leftskip, and the display
% sizes. Values given should be skips.
\def\@setenvmargins#1#2{% set left and right margins
\advance \leftskip by #1 \advance \displaywidth by -#1 %
\advance \rightskip by #2 \advance \displaywidth by -#2 %
\advance \displayindent by #1} %
%------------------------------*
% \itemize
%
% \itemize puts a bullet (or whatever you define as \itemmark)
% in front of each item. Use \itm to begin a new item.
\def\itemize{\beginEnv{itemize}% itemized list of things
\let\itm=\itemizeitem % define \itm
\if F\@isVmode\vskip-\parskip\fi % if h-mode kill skip from first \itm
}
\def\itemizeitem{% \itm for \itemize
\par\noindent % start new paragraph
\hbox to 0pt{\hss\itemmark\space}}% % put marker to left
\def\enditemize{\endEnv{itemize}}% % terminate
\def\itemmark{$\bullet$} % default marker for \itemize
%------------------------------*
% \enumerate
%
% \enumerate makes a list of items, each of them numbered. You can
% nest \enumerate within \enumerate. Begin each item with \itm.
% Note the extensive use of local registers (only one \enumcnt is allocated;
% TeX takes care of which one is currently needed. \enumlead stores the
% rest of the values only to print out item labels.) Note that \label
% can be used to get the current value of an item label.
% Usage:
% \enumerate % to start a list
% \itm <text> % for each numbered paragraph
% ...
% \endenumerate % at end the list
%
\newcount\enumDepth \enumDepth=\z@
\newcount\enumcnt
\def\enumerate{\beginEnv{enumerate}%
\global\advance\enumDepth by \@ne % start another level of nesting
\setenumlead % set the leader
\enumcnt=\z@ % reset counter to zero
\let\itm=\enumerateitem % define \itm
\if F\@isVmode\vskip-\parskip\fi % if h-mode kill skip from first \itm
}
\def\enumerateitem{% \itm for \enumerate
\par\noindent
\advance\enumcnt by \@ne %
\edef\lab@l{\enumlead \enumcur}% % for using \label
\hbox to \z@{\hss \lab@l \enummark % number and punctuation
\hskip .5em}% % and a skip
\ignorespaces} %
\def\endenumerate{% %
\global\advance\enumDepth by -\@ne % pop out one level
\endEnv{enumerate}}% % end the environment
%----------*
% DIFFERENT STYLES OF EUMARATION: \enumpoints, \enumoutline,
% \enumNumOutline, etc... Design your own!
%
% The basic idea: When \itm is invoked the item label is constructed
% as ``\enumlead\enumcur\enummark'' where \enumlead is the leading
% part of the label (which will be the same for all item in this level
% of the list), \enumcur is the appropriately formated value of \enumcnt,
% the item counter, and \enummark is the trailing punctuation (usually
% a period, but could be a parenthesis).
%
% To define an enumeration style you must define \setnumlead, which
% will in turn define \enumlead when a list is begun by \enumerate.
% You must also define \enumcur to put out the appropriate item label.
% Since lists can be contained within lists we use \enumDepth to keep track of
% how deep we are in a sub-list.
%
% The styles \enumpoints, \enumoutline and \enumNumOutline should be
% considered as useful examples. Be sure to call them BEFORE you say
% \enumerate.
% \enumpoints just numbers the items like so: "ii.jj.kk...."
% Note the use of \edef in \setnumlead to get the CURRENT value
% of \enumcur, whereas the value in the definition of \enumcur
% is the value used later, when \itm is used.
\def\enumPoints{% enumerate by numerical points
\def\setenumlead{\ifnum\enumDepth>1 % a list inside a list?
\edef\enumlead{\enumlead\enumcur.}% % yes: lead is previous label
\else\def\enumlead{}\fi}% % no: just number at first
\def\enumcur{\number\enumcnt}% %
}
\def\enumpoints{\enumPoints} % backward compatability (2.13)
% \enumOutline lists the items in an outline form, using
% upper case roman numerals, upper case letters, lower case roman
% numerals, lower case letters, arabic numbers, and finally bullets.
% Note the use of \ifcase\enumDepth, and the macros \letterN and
% \LetterN defined below.
\def\enumOutline{% enumerate a list in outline form, Roman Caps. first
\def\setenumlead{\def\enumlead{}}% % no leading part of label
\def\enumcur{\ifcase\enumDepth % For given level choose...
\or\uppercase{\XA\romannumeral\number\enumcnt}% 1) UC Roman numeral
\or\LetterN{\the\enumcnt}% % 2) UC letter
\or\XA\romannumeral\number\enumcnt % 3) LC Roman numeral
\or\letterN{\the\enumcnt}% % 4) LC letter
\or{\the\enumcnt}% % 5) arabic number
\else $\bullet$\space\fi}% % or a bullet
}
\def\enumoutline{\enumOutline} % backward compatability (2.13)
% \enumNumOutline sets up an outline starting from arabic
% numbers numbers rather than Roman caps.
\def\enumNumOutline{% enumerate a list in outline form, numbers first
\def\setenumlead{\def\enumlead{}}% % no leading part of a label.
\def\enumcur{\ifcase\enumDepth % for a given level choose...
\or{\XA\number\enumcnt}% % 1) arabic number
\or\letterN{\the\enumcnt}% % 2) LC letter
\or{\XA\romannumeral\number\enumcnt}% % 3) LC roman numeral
\else $\bullet$\space\fi}% % or a bullet
}
\def\enumnumoutline{\enumNumOutline} % backward compatability (2.13)
% \LetterN{n} gives the nth letter in the uppercase alphabet
% \letterN{n} gives the nth letter in the lowercase alphabet
\def\LetterN#1{\count@=#1 \advance\count@ 64 \XA\char\count@}
\def\letterN#1{\count@=#1 \advance\count@ 96 \XA\char\count@}
% TeXsis Defaults:
\def\enummark{.} % default punctuation
\def\enumlead{} % start with nothing in label
\enumpoints % default style
%------------------------------*
% \description gives a list of items labeled by text, not numbers.
%
% foo1 text, which may take
% more than one line
% foo2 more text
%
% Usage:
%
% \description{amount to indent as \hbox contents}
% \itm{<name1>} text1
% \itm{<name2>} text2
% ...
% \enddescription
% where <name...> is the text to label the item. <name> may take more than
% one line.
% Typically, the argument to \description is the longest single line
% <name>. You can also use \hskip if you want a particular distance.
% NOTE that \parindent may be 0 inside an environment, so \hskip\parindent
% probably won't do what you want.
%
% If the label text comes out wider than the indent space allowed
% the text will be broken into several lines. Saying \singlelinetrue
% will instead put the label text on a line by itself above the
% item. \singlelinefalse is the default.
\newbox\@desbox % used to determine how far to shift text
\newbox\@desline % box for description line(s)
\newdimen\@glodeswd % used to get \wd\@desbox inside a group
\newcount\@deslines % used to count number of lines in description
\newif\ifsingleline \singlelinefalse % default is to break long labels
\def\description#1{\beginEnv{description}% ``description'' list environment
\setbox\@desbox=\hbox{#1}% % get template in a box
\@glodeswd=\wd\@desbox % get width of that box
\@setenvmargins{\@glodeswd}{0pt}% % indent left margin
\let\itm=\descriptionitem % define \itm
\if F\@isVmode\vskip-\parskip\fi % if h-mode kill \parskip from \itm
}% % end of \description
\def\descriptionitem#1{% definition of \itm for \description
\goodbreak\noindent % end old item, start next
\setbox\@desline=\vtop\bgroup % get label text in a box
\hfuzz=100cm\hsize=\@glodeswd % suppress overfull box msg
\rightskip=\z@ \leftskip=\z@ % no margins in this box
\raggedright % ragged right margin in box
\noindent{#1}\par % text of the label
\global\@deslines=\prevgraf % get line count
\egroup % end of \setbox
%
\ifsingleline % long labels on their own line?
\ifnum\@deslines>1 % Yes: are there several lines?
\@deslineitm{#1}% % Yes: put them on one line
\else % one line might ll be too long
\setbox\@desline=\hbox{#1}% % re-set in a box to get width
\ifdim \wd\@desline>\wd\@desbox % is it too wide?
\@deslineitm{#1}% % Yes: set it on lone line
\else\@desitm\fi % else dump the label
\fi %
\else % else \singlelinefalse
\@desitm % ...so just dump the label
\fi % end \ifsingleline
\ignorespaces}
\def\@desitm{% print \description item
\noindent
\hbox to \z@{\hskip-\@glodeswd % go back for indent
\hbox to \@glodeswd{\vtop to \z@{\box\@desline\vss}% unbox it
\hss}\hss}} % some glue for a fit
\def\@deslineitm#1{% \description item on a separate line
\hbox{\hskip-\@glodeswd {#1}\hss}% % Yes: label all on one line
\vskip-\parskip\nobreak\noindent % then begin entry on next line
}
\def\enddescription{\ifhmode\par\fi % finish any existing \itm
\@setenvmargins{-\wd\@desbox}{0pt}% % doing \@setenvmargins
\endEnv{description}}
%------------------------------*
% \example is a simple way to just indent some text. It's like
% the ``list'' environments but all it does is indent on the left
% and the right and go to singlespacing.
\def\example{\beginEnv{example}%
\vskip\EnvDelt@skip % do extra skip above
\parskip=\z@ \parindent=\z@ % set \par indentation to zero
\baselineskip=\normalbaselineskip % singlespaced
} %
\def\endexample{\endEnv{example}% % end environment
\noindent}% % undo par
%------------------------------*
% \Listing is an environment for computer code listings. It's
% set in \tt type, with \obeylines and \obeyspaces and no justification.
% { and } are just characters, so to get grouping use \bgroup ... \egroup
% Indentation is controled as in the ``list'' environments.
\def\Listing{\beginEnv{Listing}% %
\vskip\EnvDelt@skip % do extra skip
\baselineskip=\normalbaselineskip % singlespaced
\obeylines % respect line endings
\parskip=\z@ \parindent=\z@ % set \par indentation to zero
\obeyspaces\tt % and obey spaces too
\def\\##1{\char92##1}% % \ for macro names
\catcode`\{=\other \catcode`\}=\other % { and } just characters
\catcode`\(=\other \catcode`\)=\other % ( and ) just characters
\catcode`\"=\other \catcode`\|=\other % " and | just characters
\catcode`\%=\other \catcode`\&=\other % so % and & are characters
\catcode`\-=\other \catcode`\==\other % so - and = are characters
\catcode`\$=\other \catcode`\#=\other % so $ and # are characters
\catcode`\_=\other \catcode`\^=\other % so _ and ^ are characters
} %
\def\endListing{\endEnv{Listing}} % end \Listing
% Use \ListCodeFile{<filename>} to directly include a source file
% in the document. Use this INSTEAD of \Listing, not after it.
% Nothing in this file is ``active,'' so you cannot have TeX commands
% in the file. Example: \ListCodeFile{hello.c}
\def\ListCodeFile#1{\Listing % invoke \Listing and read in file
\hsize=2\hsize\raggedright % allow overflow in right margin
\Listingtabs % ^^I <tab> fakes tabs
\catcode`\\=\other % \ is not active!
\input #1\relax % read in source file
\endListing}
{\catcode`\^^I=\active % these lines must end with %
\gdef\Listingtabs{\catcode`\^^I\active \let^^I=\@listingtab}
}
\def\@listingtab{\phantom{XXXXXXXX}} % 1 tab = 8 spaces
% (could be improved some day...)
%------------------------------*
% \TeXexample is an environment for TeX examples. The only special
% characters are <space>, which does the usual thing, and "|", which is the
% escape character. To use a macro in this environment, begin the name with
% "|" instead of "\". In particular, |char`|| gives a |. The enviroment is
% ended with |endTeXexample, NOT \endTeXexample:
%
% \TeXexample
% <TeX stuff>
% |endTeXexample
%
% <TeX stuff> is printed in \tt type indented by \EnvLeftskip using
% \obeylines and \obeyspaces and single spaced. If necessary, it will
% be split across pages.
\def\TeXexample{\beginEnv{TeXexample}% % TeX examples
\vskip\EnvDelt@skip % add some extra skip above
\parskip=\z@ \parindent=\z@ % set \par indentation to zero
\baselineskip=\normalbaselineskip % singlespaced
\def\par{\leavevmode\endgraf}% % \par also gives \leavevmode
\obeylines % respect line endings
\catcode`|=\z@ % make | the escape character
\ttverbatim % begin \tt type in a group
\@eatpar}% % eat initial \par
\def\endTeXexample{% % end \TeXexample
\vskip 0pt %
\endgroup % end \ttverbatim
\endEnv{TeXexample}} % end the environment
%------------------------------*
% \ttverbatim makes everything except "|" into \other, then switches
% into \tt type. "|" is made active by \TeXquoteon and is made the escape
% character by \TeXexample and \begintt.
\def\ttverbatim{\begingroup % begin a group
\catcode`\(=\other \catcode`\)=\other % make everything "other"
\catcode`\"=\other \catcode`\[=\other %
\catcode`\]=\other %
\let\do=\uncatcode \dospecials %
\obeyspaces \obeylines % obey line ends and spaces
\def\n{\vskip\baselineskip}% % \n gives a new line
\tt} % switch to typewriter type
\def\uncatcode#1{\catcode`#1=\other} % make a character "other"
{\obeyspaces\gdef {\ }} % space gives \ , not \space
%-----------------------------------*
% \TeXquoteon makes "|" active and a TeX quote. Anything enclosed
% in | ... | is printed verbatim in \tt type; ^^M's are ignored.
% \TeXquoteoff restores the normal |.
\def\TeXquoteon{\catcode`\|=\active} % turn on "TeX quotes"
\let\TeXquoteson=\TeXquoteon % synonym
\def\TeXquoteoff{\catcode`\|=\other} % turn off "TeX quotes"
\let\TeXquotesoff=\TeXquoteoff % synonym
{\TeXquoteon\obeylines % active "|" calls \ttverbatim
\gdef|{\ifmmode\vert\else % | is \vert in math mode, but
\ttverbatim \spaceskip=\ttglue % to use \tt type
\let^^M=\ % % and to ignore ^^M
\let|=\endgroup % next | turns it off
\fi} % end of \gdef|
}
% \ttvert| gives a vertical bar in \tt type. Use anywhere.
\def\ttvert{\hbox{\tt\char`\|}}
%-----------------------------------*
% \begintt is taken without modification from The TeXbook, p. 421.
% Like \TeXexample, it prints a TeX example in \tt type, but it puts the
% example in a \vbox so that it cannot be split; it is ended by \endtt,
% not |endtt:
%
% \begintt
% <TeX stuff>
% \endtt
\outer\def\begintt{$$\let\par=\endgraf \ttverbatim \parskip=0pt
\catcode`\|=0 \rightskip=-5pc \ttfinish}
{\catcode`\|=0 |catcode`|\=\other % | is temporary escape character
|obeylines % end of line is active
|gdef|ttfinish#1^^M#2\endtt{#1|vbox{#2}|endgroup$$}%
}
% \beginlines is also taken without modification from The TeXbook,
% p. 421 and is also used for TeX examples. Each line of the example
% must be enclosed in TeX quotes, | ... |. Spacing can be inserted using
% \smallbreak and similar commands. The syntax is
% \TeXquoteon
% \beginlines
% | <TeX stuff> |
% ...
% \endlines
\def\beginlines{\par\begingroup\nobreak\medskip\parindent=0pt
\hrule\kern1pt\nobreak \obeylines \everypar{\strut}}
\def\endlines{\kern1pt\hrule\endgroup\medbreak\noindent}
%==================================================*
% \theorem, \lemma, \definition, \proof, etc..
%
% Quasi-SIAM format. Theorem and Lemma have slanted typeface statements;
% Definition does not. Since Theorem and Lemma (and Corollary...) have
% a similar structure, we define a general \beginproclaim and \endproclaim
% (a'la PLAIN).
%
% \beginproclaim{title}{countername}{font for text}{prefix}{tag}
% does the general formatting, where the countername (excludes the \@
% beginning the name) will be advanced.
\def\beginproclaim#1#2#3#4#5{\medbreak\vskip-\parskip % space down
\global\XA\advance\csname #2\endcsname by \@ne % advance counter
\edef\lab@l{\@chaptID\@sectID % get header plus
\number\csname #2\endcsname}% % counter number
\tag{#4#5}{\lab@l}% % tag it
\noindent{\bf #1 \lab@l.\space}% % print number
\begingroup #3} % begin group
\def\endproclaim{%
\par\endgroup\ifdim\lastskip<\medskipamount % end group and
\removelastskip\penalty55\medskip\fi} % fix spacing
% \theorem{tag} defines a theorem. \Theorem{tag} refers to it in the
% text as Theorem~number.
\newcount\theoremnum \theoremnum=\z@
\def\theorem#1{\beginproclaim{Theorem}{theoremnum}{\sl}{Thm.}{#1}}
\let\endtheorem=\endproclaim
\def\Theorem#1{Theorem~\use{Thm.#1}}
% The same for lemma:
\newcount\lemmanum \lemmanum=\z@
\def\lemma#1{\beginproclaim{Lemma}{lemmanum}{\sl}{Lem.}{#1}}
\let\endlemma=\endproclaim
\def\Lemma#1{Lemma~\use{Lem.#1}}
% The same for corollary:
\newcount\corollarynum \corollarynum=\z@
\def\corollary#1{\beginproclaim{Corollary}{corollarynum}{\sl}{Cor.}{#1}}
\let\endcorollary=\endproclaim
\def\Corollary#1{Corollary~\use{Cor.#1}}
% Definitions are little special; their text is not slanted.
\newcount\definitionnum \definitionnum=\z@ % Definition
\def\definition#1{\beginproclaim{Definition}{definitionnum}{\rm}{Def.}{#1}}
\let\enddefinition=\endproclaim
\def\Definition#1{Definition~\use{Def.#1}}
% Proofs are even more special.
\def\proof{\medbreak\vskip-\parskip\noindent{\it Proof. }}
\def\blackslug{% % QED "black box"
\setbox0\hbox{(}% % ( gives size
\vrule width.5em height\ht0 depth\dp0}% % use ) for size
\def\QED{\blackslug} % to end proof
\def\endproof{\quad\blackslug\par\medskip}
% >>> EOF TXSenvmt.tex <<<